package com.timoon.webcomponent.utility.helpinfo;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.request.resource.PackageResourceReference;
import org.apache.wicket.spring.injection.annot.SpringBean;

import com.timoon.app.resource.image.ImageLocation;
import com.timoon.sample.dao.model.InfoSort;
import com.timoon.sample.utils.SystemConfig;

/**
 *<p>功能:联系电话</p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013</p>
 *<p>Company:sky</p>
 *@author 付乐天
 *@version 1.0 */

public class CustomerCenter extends Panel {
	
	@SpringBean(name="sample.infoSort")
	private InfoSortService infoSortService;

	public CustomerCenter(String id) {
		super(id);
		// TODO Auto-generated constructor stub
		
		this.renderContact();
	}
	
	private void renderContact() {
		// TODO Auto-generated method stub
		add(new Image("wk_phone", new PackageResourceReference(ImageLocation.class,"other/phonecall.png")));
		
		
		InfoSort infoSort1=this.infoSortService.getUniqueInfoSortByType(SystemConfig.INFO_SORT_TYPE_PHONE);
		
		if(infoSort1==null){
			throw new RuntimeException("当从表【InfoSort】中尝试获取【TYPE="+SystemConfig.INFO_SORT_TYPE_PHONE+"】作为【号码】时，结果为null");
		}
		
		add(new Label("wk_phonelabel",infoSort1.getValue()));
	}

}
